package com.xxx.coll;

import java.util.ArrayList;
import java.util.Iterator;

/**
 * @version v1.0
 * @Description:
 * @Author zhanzhongxin
 * @Date 2021/7/20 14:46
 * @Copyright 博为峰
 */
public class ArrayListDemo {
    public static void main(String[] args) {
        ArrayList arrayList = new ArrayList();
        arrayList.add(new Student("张三", 20));
        arrayList.add(new Student("李四", 30));
        arrayList.add(new Student("王五", 50));
        arrayList.add(new Student("王五", 50));
//        System.out.println(new Student("王五", 50).equals(new Student("王五", 50)));
//        System.out.println(arrayList);
//        for (int i = 0; i < arrayList.size(); i++) {
//            Student student = (Student) arrayList.get(i);
//            System.out.println(student.getName());
//        }

        Iterator iterator = arrayList.iterator();
        while (iterator.hasNext()) {
            Student student = (Student) iterator.next();
            System.out.println(student.getName());
        }

    }
}
